package edu.unr.cater.npap.client.managed.activity;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.requestfactory.shared.EntityProxyId;
import com.google.web.bindery.requestfactory.shared.RequestContext;
import edu.unr.cater.npap.client.managed.request.ApplicationRequestFactory;
import edu.unr.cater.npap.client.managed.ui.AddressDetailsView;
import edu.unr.cater.npap.client.managed.ui.AddressEditView;
import edu.unr.cater.npap.client.managed.ui.AddressListView;
import edu.unr.cater.npap.client.managed.ui.AddressMobileDetailsView;
import edu.unr.cater.npap.client.managed.ui.AddressMobileEditView;
import edu.unr.cater.npap.client.managed.ui.ContactSetEditor;
import edu.unr.cater.npap.client.proxy.AddressProxy;
import edu.unr.cater.npap.client.proxy.ContactProxy;
import edu.unr.cater.npap.client.request.AddressRequest;
import edu.unr.cater.npap.client.scaffold.ScaffoldApp;
import edu.unr.cater.npap.client.scaffold.place.CreateAndEditProxy;
import edu.unr.cater.npap.client.scaffold.place.FindAndEditProxy;
import edu.unr.cater.npap.client.scaffold.place.ProxyPlace;
import java.util.Set;

public class AddressActivitiesMapper extends AddressActivitiesMapper_Roo_Gwt {

    public AddressActivitiesMapper(ApplicationRequestFactory requests, PlaceController placeController) {
        this.requests = requests;
        this.placeController = placeController;
    }

    public Activity getActivity(ProxyPlace place) {
        switch(place.getOperation()) {
            case DETAILS:
                return new AddressDetailsActivity((EntityProxyId<AddressProxy>) place.getProxyId(), requests, placeController, ScaffoldApp.isMobile() ? AddressMobileDetailsView.instance() : AddressDetailsView.instance());
            case EDIT:
                return makeEditActivity(place);
            case CREATE:
                return makeCreateActivity();
        }
        throw new IllegalArgumentException("Unknown operation " + place.getOperation());
    }
}
